# 导包
import sys
sys.path[0] = '../'

from tensorflow.keras.models import load_model
from utils.data_generator import test_generator, pred_generator
from utils.image_plot import plot_image



# 读取测试集
test_gen = test_generator(
    data_dir='../dataset/imagenette2-160/test',
    target_size=(160, 160),
    batch_size=32,
    class_mode='categorical'
)
"""
# 读取预测集
pred_gen = pred_generator(
    data_dir='../dataset/natural-scenes/seg_train',
    target_size=(38, 38),
    batch_size=32,
    class_mode=None
)
"""


# 模型保存的相对路径
model_path = '../model/model-AlX'
# 载入模型
load_model = load_model(filepath=model_path)

# 模型验证测试集
loss, accuracy = load_model.evaluate(x=test_gen)

"""
# 获取1个batch size的测试集
pred_batch = pred_gen.next()

# 载入的模型对一个batch size的预测集进行预测
pred_result = load_model.predict(x=pred_batch)

# 取15张预测集图片的结果进行查看
plot_image(pred_batch, pred_result)
"""

